/*Do-file for "Treating abandoned mine drainage can protect streams cost effectively and benefit vulnerable communities." Run on Stata/SE Version 18.0.
The dataset "SystemlevelData" is at the treatment system level, with each row corresponding to a treatment system.*/
 
clear

use SystemLevelData
		
drop if iNoFlow==1
		
******************************************************************************
*SI figures 2 and 3 
*****************************************************************************

*Figure 2 - pH over time

	twoway scatter ph0 yearGroup, graphregion(color(white)) /*
	*/ ytitle("Inflow pH", margin(medium)) ylabel(,format(%9.0fc)) /*
	*/ xtitle("Year Group", margin(medium))  /*
	*/ xlabel(1 "<1995" 2 "1995-1999" 3 "2000-2004" 4 "2005-2009" 5 "2010-2014" 6 ">2014",format(%9.0fc)) 
	graph export phOverTime.pdf, replace
	
*Figure 3 - Cost per liter over time
	twoway scatter TC_liter yearGroup if TC_liter <20000, graphregion(color(white)) /*
	*/ ytitle("Cost Per Liter Per Minute ($)", margin(medium)) ylabel(,format(%9.0fc)) /*
	*/ xtitle("Year Group", margin(medium)) xlabel(1 "<1995" 2 "1995-1999" 3 "2000-2004" 4 "2005-2009" 5 "2010-2014" 6 ">2014", format(%9.0fc))
	graph export costOverTime.pdf, replace